package com.se.web.tags;

import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.BodyTagSupport;

public class SubRangePagingTag extends BodyTagSupport
{
  private static final long serialVersionUID = 970271801746974027L;
  private int startPage = 1;
  private int curPage = 1;
  private int pageCount = 10;
  private String startId;
  private String[] pages;
  private String prevImage = "";
  private String nextImage = "";
  private String splitImage = "";
  private String alinkCss = "";
  private String curPageCss = "";
  private String textCss = "";
  private String listUrl = "";
  private int BACKWARD = 0;
  private int FORWARD = 1;

  public void setAlinkCss(String paramString)
  {
    this.alinkCss = paramString;
  }

  public void setCurPage(int paramInt)
  {
    this.curPage = paramInt;
  }

  public void setPageCount(int paramInt)
  {
    this.pageCount = paramInt;
  }

  public void setCurPageCss(String paramString)
  {
    this.curPageCss = paramString;
  }

  public void setPages(String[] paramArrayOfString)
  {
    this.pages = paramArrayOfString;
  }

  public void setStartId(String paramString)
  {
    this.startId = paramString;
  }

  public void setListUrl(String paramString)
  {
    this.listUrl = paramString;
  }

  public void setNextImage(String paramString)
  {
    this.nextImage = paramString;
  }

  public void setPrevImage(String paramString)
  {
    this.prevImage = paramString;
  }

  public void setSplitImage(String paramString)
  {
    this.splitImage = paramString;
  }

  public void setStartPage(int paramInt)
  {
    this.startPage = paramInt;
  }

  public void setTextCss(String paramString)
  {
    this.textCss = paramString;
  }

  public int doStartTag()
    throws JspTagException
  {
    StringBuffer localStringBuffer = new StringBuffer();
    String str = "&";
    if (this.listUrl.indexOf("?") < 0)
      str = "?";
    try
    {
      if (this.startPage > 1)
      {
        localStringBuffer.append("<a href=\"").append(this.listUrl + str).append("startId=").append(this.pages[0]).append("&startPage=").append(this.startPage - this.pageCount).append("&curPage=").append(this.startPage - this.pageCount).append("&direction=").append(this.BACKWARD).append("\"");
        if (this.alinkCss.length() > 0)
          localStringBuffer.append(" class=\"").append(this.alinkCss).append("\">");
        else
          localStringBuffer.append(">");
        if (this.textCss.length() > 0)
          localStringBuffer.append("<font class=\"").append(this.textCss).append("\">");
        if (this.prevImage.length() > 0)
          localStringBuffer.append(this.prevImage);
        else
          localStringBuffer.append("[Prev]&nbsp;");
        if (this.textCss.length() > 0)
          localStringBuffer.append("</font>");
        localStringBuffer.append("</a>");
      }
      else
      {
        if (this.textCss.length() > 0)
          localStringBuffer.append("<font class=\"").append(this.textCss).append("\">");
        if (this.prevImage.length() > 0)
          localStringBuffer.append(this.prevImage);
        else
          localStringBuffer.append("[Prev]&nbsp;");
        if (this.textCss.length() > 0)
          localStringBuffer.append("</font>");
      }
      if ((this.pages == null) || (this.pages.length == 0))
      {
        localStringBuffer.append("<span");
        if (this.curPageCss.length() > 0)
          localStringBuffer.append(" class=\"").append(this.curPageCss).append("\"");
        localStringBuffer.append(">1</span>&nbsp;");
      }
      else
      {
        for (int i = 0; (i < this.pages.length) && (i < this.pageCount); i++)
          if (i == this.curPage - this.startPage)
          {
            localStringBuffer.append("<span");
            if (this.curPageCss.length() > 0)
              localStringBuffer.append(" class=\"").append(this.curPageCss).append("\">");
            else
              localStringBuffer.append(">");
            localStringBuffer.append(this.startPage + i);
            localStringBuffer.append("</span>&nbsp;");
          }
          else
          {
            localStringBuffer.append("<a href=\"").append(this.listUrl + str).append("startId=").append(this.startId).append("&startPage=").append(this.startPage).append("&curPage=").append(this.startPage + i).append("&direction=").append(this.FORWARD).append("\"");
            if (this.alinkCss.length() > 0)
              localStringBuffer.append(" class=\"").append(this.alinkCss).append("\">");
            else
              localStringBuffer.append(">");
            if (this.textCss.length() > 0)
              localStringBuffer.append("<font class=\"").append(this.textCss).append("\">");
            localStringBuffer.append(this.startPage + i);
            if (this.splitImage.length() > 0)
            {
              if (i + 1 < this.pageCount)
                localStringBuffer.append(this.splitImage);
            }
            else if (i + 1 < this.pageCount)
              localStringBuffer.append("&nbsp;");
            if (this.textCss.length() > 0)
              localStringBuffer.append("</font>");
            localStringBuffer.append("</a>");
          }
      }
      if ((this.pages != null) && (this.pages.length > this.pageCount))
      {
        localStringBuffer.append("<a href=\"").append(this.listUrl + str).append("startId=").append(this.pages[(this.pages.length - 1)]).append("&startPage=").append(this.startPage + this.pageCount).append("&curPage=").append(this.startPage + this.pageCount).append("&direction=").append(this.FORWARD).append("\"");
        if (this.alinkCss.length() > 0)
          localStringBuffer.append(" class=\"").append(this.alinkCss).append("\">");
        else
          localStringBuffer.append(">");
        if (this.textCss.length() > 0)
          localStringBuffer.append("<font class=\"").append(this.textCss).append("\">");
        if (this.nextImage.length() > 0)
          localStringBuffer.append(this.nextImage);
        else
          localStringBuffer.append("&nbsp;[Next]");
        if (this.textCss.length() > 0)
          localStringBuffer.append("</font>");
        localStringBuffer.append("</a>");
      }
      else
      {
        if (this.textCss.length() > 0)
          localStringBuffer.append("<font class=\"").append(this.textCss).append("\">");
        if (this.nextImage.length() > 0)
          localStringBuffer.append(this.nextImage);
        else
          localStringBuffer.append("&nbsp;[Next]");
        if (this.textCss.length() > 0)
          localStringBuffer.append("</font>");
      }
      JspWriter localJspWriter = this.pageContext.getOut();
      localJspWriter.print(localStringBuffer.toString());
    }
    catch (Exception localException)
    {
      throw new JspTagException(localException.toString());
    }
    return 0;
  }
}

/* Location:           D:\DevApp\workspace\DevKsnetWeb9.3\WebContent\WEB-INF\lib\netville-2.2.3.jar
 * Qualified Name:     netville.web.tags.SubRangePagingTag
 * JD-Core Version:    0.6.2
 */